package com.yonyou.crm.base.doc.rmimpl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yonyou.crm.base.doc.entity.BaseDocVO;
import com.yonyou.crm.base.doc.rmitf.IBaseDocRmService;
import com.yonyou.crm.base.doc.service.BaseDocBizServiceImpl;
import com.yonyou.crm.base.doc.service.BaseDocDetailBizServiceImpl;
import com.yonyou.crm.common.page.entity.Page;

@Service("dubboxProviderBaseDoc")
public class BaseDocRmServiceImpl implements IBaseDocRmService {
	
	@Autowired
	private BaseDocBizServiceImpl bizService;
	@Autowired
	private BaseDocDetailBizServiceImpl detailBizService;
	
	@Override
	public Page<BaseDocVO> getBaseDocPage(Page<BaseDocVO> page, Map<String, Object> paramMap) {
		return bizService.getPage(page,paramMap);
	}

	@Override
	public BaseDocVO insertBaseDoc(BaseDocVO baseDoc) {
		baseDoc = bizService.save(baseDoc);
		bizService.getbaseDocById(baseDoc.getId());
		//返回新增信息
		return bizService.getbaseDocById(baseDoc.getId());
	}

	@Override
	public Page<BaseDocVO> deleteBaseDocByIDs(String[] ids, Page<BaseDocVO> page, Map<String, Object> paramMap) {
		bizService.deletebaseDocByIDs(ids);
		//返回删除后的列表信息
		Page<BaseDocVO> baseDocPage = bizService.getPage(page, paramMap);
		return baseDocPage;
	}

	@Override
	public BaseDocVO updateBaseDoc(BaseDocVO baseDoc) {
		bizService.updatebaseDoc(baseDoc);
		bizService.getbaseDocById(baseDoc.getId());
		return bizService.getbaseDocById(baseDoc.getId());
	}

	@Override
	public BaseDocVO detail(Long id) {
		return bizService.getbaseDocById(id);
	}

	@Override
	public Map<String, Object> getDocAndDetailList(Map<String, Object> idsMap) {
		return bizService.getDocAndDetailList(idsMap);
	}

	@Override
	public List<BaseDocVO> getDocByIds(String[] ids) {
		return bizService.getDocByIds(ids);
	}
	
}

